#!/bin/bash

# Start the 5250proxy 
#

source /etc/SuSEconfig/profile

export PATH=$PATH:/opt/IBMJava/jre/bin

ulimit -c 1000000

if [ -f /var/hsc/log/.DEBUG_HSC ]; then
   /opt/hsc/bin/5250proxy -t -l en_US -a /opt/hsc/bin/vshelper > /var/hsc/log/5250proxy.log 2>&1 &
   TOP_5250_PROXY_ID=$!
else
   /opt/hsc/bin/5250proxy -l en_US -a /opt/hsc/bin/vshelper &
   TOP_5250_proxy_ID=$!
fi

# Record the thread ids for the started 5250proxy 
sleep 5
ps -efwww | grep 5250proxy | awk {'print $2'} > /var/hsc/5250proxy_proc_ids

wait $TOP_5250_PROXY_ID
echo "5250proxy stopped on "`date` > /tmp/5250proxyStopped.log

